<?php $params      = array_merge($params, array('max' => 'max_per_page=js')) ?>
<?php $total_items = count($pager->getResults()) ?>
<?php $from        = 1 + ($sf_params->get('max') * ($sf_params->get('page') - 1)) ?>
<?php $to          = $sf_params->get('max') * $sf_params->get('page') ?>

<table class="pager" cellspacing="0"<?php if (!$pager->haveToPaginate() and $total_items == 0): ?> style="display: none;" <?php endif; ?>>
<tr>
  <td>
    <?php $links = count($pager->getLinks(11)) ?>
    <?php if ($links <= 1): ?>
      <strong><?php echo $pager->getNbResults() ?> Item<?php if ($total_items > 1): ?>s<?php endif; ?></strong>
    <?php else: ?>
      Items <?php echo $from ?> 
      to <?php echo $from == $pager->getNbResults() ? $pager->getNbResults() : $to ?> of 
      <?php echo $pager->getNbResults() ?> total
    <?php endif ?>
  </td>
  
  <?php if ($links): ?>
  <td class="pages">
    <strong>Page:</strong>
    <ol>
    <?php if ($pager->getPage() > 1): ?>
      <li><?php echo link_to_get_url(image_tag('account/pager_arrow_left.gif', array('border' => 0)), $uri, array_merge($params, array('page' => $pager->getPreviousPage())) ) ?></li>
    <?php endif; ?>
    
    <?php foreach ($pager->getLinks(5) as $page): ?>
      <li><?php echo $page == $pager->getPage() ? sprintf('<span class="on">%s</span>', $page) 
                                              : link_to_get_url($page, $uri, array_merge($params, array('page' => $page)) ) ?></li>
    <?php endforeach; ?>
    
    <?php if ($pager->getPage() < $links): ?>
      <li><?php echo link_to_get_url(image_tag('account/pager_arrow_right.gif', array('border' => 0)), $uri, array_merge($params, array('page' => $pager->getNextPage())) ) ?></li>
    <?php endif; ?>
    </ol>
  </td>
  <?php endif; ?>
  
  <td class="a-right">
    <input type="hidden" id="page" id="page" value="<?php echo $pager->getPage() ?>" />
    Show 
    <?php echo select_tag('max_per_page', 
                            array(
                                   '10'  => '10', 
                                   '20'  => '20', 
                                   '50'  => '50', 
                                 ), 
                            $sf_params->get('max'), 
                            array('onchange' => get_url($uri, $params))
        ) ?>
    per page
  </td>
  
</tr>
</table>